import { instance } from './index'

interface IUserinfo {
  username: string
  password: string
}

interface ILoginData {
  data: any
  [props: string]: any
}
export const loginfn = (info: IUserinfo): any => {
  return new Promise((resolve, reject) => {
    instance
      .request({ url: '/login', method: 'post', data: info })
      .then((res: ILoginData) => {
        resolve(res)
      })
      .catch((err) => {
        reject(err)
      })
  })
}
